﻿
@{
    //搜索结果页
    ViewBag.Title = "搜索结果";
    Layout = "~/Views/Home/_HomeLayout.cshtml";
}
<div class="main-container container">
    <ul class="breadcrumb">
        <li><a href="#"><i class="fa fa-home"></i></a></li>
        <li><a href="">搜索</a></li>
    </ul>
    <div class="row">
        <!--Left Part Start -->
        <aside class="col-sm-4 col-md-3" id="column-left">
            <div class="module menu-category titleLine">
                <h3 class="modtitle">类别列表</h3>
                <div class="modcontent">
                    <div class="box-category">
                        <ul id="cat_accordion" class="list-group">
                            @{IList<Shop.Wares.Models.WaresCategory> wcinfo = ViewBag.wcinfo;}
                            @foreach (var item in wcinfo)
                            {
                                <li class="hadchild">
                                    <a href="Category-@(item.CID)-0" class="cutom-parent">@item.CName</a>   <span class="button-view  fa fa-plus-square-o"></span>
                                    @Html.Action("_SonCategory", "Home", new { CID = item.CID })
                                </li>
                            }
                        </ul>
                    </div>
                </div>
            </div>

            <div class="module latest-product titleLine">
                <h3 class="modtitle">最新产品</h3>
                <div class="modcontent ">
                    @{ IList<Shop.Wares.Models.Wares> nwinfo = ViewBag.nwinfo;}
                    @foreach (var item in nwinfo)
                    {
                        <div class="product-latest-item">
                            <div class="media">
                                <div class="media-left">
                                    <a href="WaresProduct-@item.WID"><img src="@item.Url" alt="@item.WName" title="@item.WName" class="img-responsive" style="width: 100px; height: 82px;"></a>
                                </div>
                                <div class="media-body">
                                    <div class="caption">
                                        <h4><a href="WaresProduct-@item.WID">@item.WName</a></h4>

                                        <div class="price">
                                            <span class="price-new">价格:@item.PPrice</span>
                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>
                    }
                </div>
            </div>
        </aside>
        <!--Left Part End -->
        <!--Middle Part Start-->
        <div id="content" class="col-md-9 col-sm-8">
            <div class="products-category">
                <!-- Filters -->
                <div class="product-filter filters-panel">
                    <div class="row">
                        <div class="col-md-2 visible-lg">
                            @*为了首页舍弃他*@
                            @*<div class="view-mode">
                                    <div class="list-view">
                                        <button class="btn btn-default grid active" data-view="grid" data-toggle="tooltip" data-original-title="网格"><i class="fa fa-th"></i></button>
                                        <button class="btn btn-default list" data-view="list" data-toggle="tooltip" data-original-title="列表"><i class="fa fa-th-list"></i></button>
                                    </div>
                                </div>*@
                        </div>
                        <div class="short-by-show form-inline text-right col-md-7 col-sm-8 col-xs-12">
                            <div class="form-group short-by">
                                <label class="control-label" for="input-sort">查看方式:</label>
                                <select id="OrderBy" class="form-control">
                                    <option value="OrderTime" selected="selected">默认</option>
                                    <option value="Stock">库存</option>
                                    <option value="SaleNum">销售量</option>
                                    <option value="PPrice">价格</option>
                                </select>
                            </div>
                            <div class="form-group short-by">
                                <label class="control-label" for="Lift">排序方式:</label>
                                <select id="Lift" name="Lift" class="form-control">
                                    <option value="1" selected="selected">正序</option>
                                    <option value="0">倒序</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label class="control-label" for="itemsPerPage">显示:</label>
                                <select id="itemsPerPage" class="form-control">
                                    <option value="9" selected="selected">9</option>
                                    <option value="12">12</option>
                                    <option value="15">15</option>
                                    <option value="18">18</option>
                                    <option value="21">221</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- //end Filters -->
                <div id="WareMain">
                    @Html.Action("_WaresCategory", "Home", new { page = 1, itemsPerPage = 9, CID = 0, SCID = 0, WName = ViewBag.WName, OrderBy = "OrderTime", Lift = "1" })
                </div>
            </div>

        </div>

    </div>
    <!--Middle Part End-->
</div>
<script type="text/javascript">
    $("#OrderBy").change(function () {
        var CID = 0;
        var SCID = 0;
        var OrderBy = $("#OrderBy").val();
        $.ajax({
            cache: false,//是否从缓存中读取
            type: 'post',//方式
            url: '/Home/_WaresCategory',
            data: { page: 1, itemsPerPage: $("#itemsPerPage").val(), CID: CID, SCID: SCID, WName: "@ViewBag.WName", OrderBy: OrderBy, Lift: $("#Lift").val() },
            dataType: 'text',//返回数据格式
            success: function (data) {
                $("#WareMain").html(data);
                //回到顶部
                $("html,body").animate({ scrollTop: 180 }, 200);
            },
            error: function () {
                alert("Ajax调用出错请与管理员联系");
            }
        });
    });
    $("#itemsPerPage").change(function () {
        var CID = 0;
        var SCID = 0;
        var OrderBy = $("#OrderBy").val();
        $.ajax({
            cache: false,//是否从缓存中读取
            type: 'post',//方式
            url: '/Home/_WaresCategory',
            data: { page: 1, itemsPerPage: $("#itemsPerPage").val(), CID: CID, SCID: SCID, WName: "@ViewBag.WName", OrderBy: OrderBy, Lift: $("#Lift").val() },
            dataType: 'text',//返回数据格式
            success: function (data) {
                $("#WareMain").html(data);
                //回到顶部
                $("html,body").animate({ scrollTop: 180 }, 200);
            },
            error: function () {
                alert("Ajax调用出错请与管理员联系");
            }
        });
    });
    $("#Lift").change(function () {
        var CID = 0;
        var SCID = 0;
        var OrderBy = $("#OrderBy").val();
        $.ajax({
            cache: false,//是否从缓存中读取
            type: 'post',//方式
            url: '/Home/_WaresCategory',
            data: { page: 1, itemsPerPage: $("#itemsPerPage").val(), CID: CID, SCID: SCID, WName: "@ViewBag.WName", OrderBy: OrderBy, Lift: $("#Lift").val() },
            dataType: 'text',//返回数据格式
            success: function (data) {
                $("#WareMain").html(data);
                //回到顶部
                $("html,body").animate({ scrollTop: 180 }, 200);
            },
            error: function () {
                alert("Ajax调用出错请与管理员联系");
            }
        });
    });
    function JumpPage(Page) {
        var CID = 0;
        var SCID = 0;
        var OrderBy = $("#OrderBy").val();
        $.ajax({
            cache: false,//是否从缓存中读取
            type: 'post',//方式
            url: '/Home/_WaresCategory',
            data: { page: Page, itemsPerPage: $("#itemsPerPage").val(), CID: CID, SCID: SCID, WName: "@ViewBag.WName", OrderBy: OrderBy, Lift: $("#Lift").val() },
            dataType: 'text',//返回数据格式
            success: function (data) {
                $("#WareMain").html(data);
                //回到顶部
                $("html,body").animate({ scrollTop: 180 }, 200);
            },
            error: function () {
                alert("Ajax调用出错请与管理员联系");
            }
        });
    }
</script>
